import org.python.core.PyFunction;
import org.python.core.PyInteger;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;

import java.io.IOException;

/**
 * 作者: LDL
 * 功能说明:
 * 创建日期: 2015/8/19 14:03
 */
public class PythonTest {
    public static void main(String[] args) throws IOException {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.execfile("D:\\demo.py");  ///执行python py文件
        PyFunction func = interpreter.get("adder",PyFunction.class);
        int a = 2010, b = 2 ;
        PyObject pyobj = func.__call__(new PyInteger(a), new PyInteger(b));
        System.out.println("anwser = " + pyobj.toString());

    }
}
